package cn.hqm.hqmtechnology.controller;

import cn.hqm.hqmtechnology.common.R;
import cn.hqm.hqmtechnology.dao.dto.MemberInfoDTO;
import cn.hqm.hqmtechnology.dao.dto.MenumDTO;
import cn.hqm.hqmtechnology.dao.po.MemberRole;
import cn.hqm.hqmtechnology.dao.po.Menum;
import cn.hqm.hqmtechnology.service.MemberInfoService;
import cn.hqm.hqmtechnology.service.MemberRoleService;
import cn.hqm.hqmtechnology.utils.RedisUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import cn.hqm.hqmtechnology.service.MenumService;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@RestController
public class MenumController {

    @Resource
    private MenumService menumService;

    @PostMapping("/menum/list")
    public R list(HttpServletRequest httpServletRequest,@RequestBody MenumDTO menumDTO){
        String token = httpServletRequest.getHeader("Authorization");
        return R.ok(menumService.listMenum(token,menumDTO));
    }

    @PostMapping("/menum/addMenum")
    public R addMenum(@RequestBody MenumDTO menumDTO){
        return R.ok(menumService.addMenum(menumDTO));
    }

    @PostMapping("/menum/delMenum")
    public R delMenum(@RequestBody MenumDTO menumDTO,HttpServletRequest httpServletRequest){
        String token = httpServletRequest.getHeader("Authorization");
        return R.ok(menumService.delMenum(menumDTO,token));
    }

}